package com.ticket.sass.common.entity.tenant;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 商品SKU
 * </p>
 *
 * @author ywb
 * @since 2024-03-06
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("commodity_skus")
@ApiModel(value="CommoditySkusEntity对象", description="商品SKU")
public class CommoditySkuEntity implements Serializable {
    @ApiModelProperty(value = "主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    
    @ApiModelProperty(value = "售价")
    private BigDecimal salePrice;
    
    @ApiModelProperty(value = "原价（划线价）")
    private BigDecimal marketPrice;
    
    @ApiModelProperty(value = "库存数量")
    private Integer stockNum;
    
    @ApiModelProperty(value = "已售数量")
    private Integer soldNum;
    
    @ApiModelProperty(value = "封面图")
    private String cover;
    
    @ApiModelProperty(value = "是否有规格")
    private Boolean hasAttr;
    
    @ApiModelProperty(value = "外部sku编码")
    private String externalCode;
    
    @ApiModelProperty(value = "发布状态：0 未发布，1已发布")
    private Integer publishStatus;
    
    @ApiModelProperty(value = "卖品id")
    private Long commodityId;
    
    @ApiModelProperty(value = "影院 id")
    private Long cinemaId;
    
    @ApiModelProperty(value = "租户 id")
    private Long tenantId;

    @Version
    private Integer version;
    
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    public LocalDateTime createdAt;
    
    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    public LocalDateTime updatedAt;
    
    @TableField(select = false)
    @ApiModelProperty(value = "删除时间")
    @TableLogic(value = "null", delval = "now()")
    public LocalDateTime deletedAt;

    @TableField(select = false)
    private CommodityEntity commodity;

    @TableField(exist = false)
    private List<CommoditySkuAttrValueMapEntity> skuAttrValueMaps;
}
